<?php
namespace app\common\model;
use think\Config;
use think\Db;
use think\Model;

class Paidan extends Model{

    protected $table = "jiujiu_shop_paidan";


    public function  getUserPaidanNum($uid,$grade){
        return $this->where('uid',$uid)->where('ugrade',$grade)->count();
    }



    public function getUserPaidan($uid){

        return Db::table('jiujiu_shop_paidan')
            ->field(['jiujiu_shop_paidan.createTime as pdTime','jiujiu_user.*'])
            ->join('jiujiu_user','jiujiu_user.uid=jiujiu_shop_paidan.buid','LEFT')
            ->where('jiujiu_shop_paidan.uid',$uid)
            ->select();

    }
}